<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'店长中心','icon'=>'icon-shouye','action'=>'jy_mzhaoshang/index/'),
		array('title'=>'店长佣金','icon'=>'icon-yiban','action'=>'jy_mzhaoshang/commission/'),
		array('title'=>'店长订单','icon'=>'icon-dingdan','action'=>'jy_mzhaoshang/order/'),
		array('title'=>'我的商户','icon'=>'icon-paihao0','action'=>'jy_mzhaoshang/down/'),
	);
	$return['item']=$this->plugin_setting('basic');
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'switch','title'=>'是否开启商户店长','name'=>'isopen'),
					//array('type'=>'radio','title'=>'分润模式','name'=>'feetype','options'=>'feetype'),
					array('type'=>'radio','title'=>'成为商户店长条件','name'=>'become','options'=>'become'),
					array('type'=>'unitstring','unit'=>'元','title'=>'自购总部商品金额','name'=>'goods_fee','show'=>array('become'=>3)),
					array('type'=>'choose_many','title'=>'购买指定商品','name'=>'become_goods','show'=>array('become'=>4),'action'=>'jy_weishop/goods.get_goods/many/nomerch=1','choose_title'=>'选择参与的商品','help'=>'（多个商品时，任意其中一个）注意：注意触发升级时机，需核销的商品，只有核销后才会完成！虚拟商品，发货后自动会完成！'),
					array('type'=>'checkbox','title'=>'商户店长升级考核指标','name'=>'level_up_types','options'=>'leveltype','help'=>'这个升级条件指商户店长商城的订单金额或者订单个数'),
					array('type'=>'switch','title'=>'会员中心显示商户店长入口','name'=>'member_show'),
					array('name'=>'commissiontype','title'=>'默认佣金计算方式','type'=>'radio','help'=>'第一种：按商品实际成交价×百分比,说明：①、实际成交价,即最终成交价！；第二种：按商品利润：【实际成交价-成本】×百分比,说明：①、实际成交价-商品成本价；','options'=>'commissiontypes'),
					array('type'=>'unitstring','title'=>'商户店长有效时长','name'=>'bao_days','unit'=>'天','help'=>'留空不生效；如果成为商户店长条件设置为【自购指定总部商品/购买指定商品】，多次购买会叠加延期'),
					array('type'=>'radio','title'=>'商户店长是否需要审核','name'=>'become_check','options'=>'is'),
					array('type'=>'radio','title'=>'商户店长必须完善资料','name'=>'become_reg','options'=>'is'),
				)
			),
			array(
				'title'=>'结算设置',
				'list'=>array(
					array('type'=>'checkbox','title'=>'不支持分佣的支付方式','name'=>'pay_type','options'=>'pay_type','help'=>'<red>勾选不支持分佣的；如果一半的支持，一半抵扣又不支持，则只计算真实《支持支付方式的金额》，不支持的将减去！</red>'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'unitstring','unit'=>'%','title'=>'佣金打款手续费（%）','name'=>'balance_per'),
					array('type'=>'string','title'=>'免手续费提现区间开始金额','name'=>'balance_money_start'),
					array('type'=>'string','title'=>'免手续费提现区间结束金额','name'=>'balance_money_end','help'=>'当提现手续费金额在此区间内时,不扣除提现手续费. 结束金额 必须大于 开始金额才能生效'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，订单才能申请结算,设置0或空，订单完成就可以结算'),
				),
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['leveltype']=$this->level_up_types;
	$return['agent_types']=$this->agent_types;
	$return['commissiontype']=$this->commission_types;
	$return['commissiontypes']=$this->commission_types2;
	$return['become']=array('0'=>'无条件','3'=>'自购总部商品金额','4'=>'自购指定总部商品');
	$return['level']=$this->level_types;
	$return['feetype']=array('0'=>'商户商品成交产生分润','1'=>'商户的私域会员购买总部商品产生分润（商户私域变现）');
	$return['is']=array('0'=>'否','1'=>'是');
	$return['pay_type']=get_pay_types();
	$return['withdraw']=$this->pay_types;
	$return['htmls']=$htmls;
	exi($return);
}


